<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
	<title th:text="${session.title}">123</title>
	<link th:replace="common/header"/>
	<link rel="stylesheet" th:href="@{/css/ace-skins.min.css}" />
	<link rel="stylesheet" th:href="@{/css/colorbox.css}" />
    <link rel="stylesheet" type="text/css" th:href="@{/css/jquery.autocomplete.css}" />
</head>
	<body class="navbar-fixed">
  	<div th:replace="common/top"></div>
		<div class="container-fluid main_bg" id="main-container">
			<a id="menu-toggler" href="#"><span></span></a>
			<div th:replace="common/menu"></div>
			<div id="main-content" class="clearfix">
				<div id="page-content" class="clearfix">
					<div th:replace="common/title"></div>
					<div th:if="${session.footUser.qx.text == '会员' || session.footUser.qx.text == 'VIP1' || session.footUser.qx.text == 'VIP2' || session.footUser.qx.text == 'VIP3'}">
                        <h3 th:if="${null == footBfinfo || !canGoOn}">报分限制场次每赛季30场常规赛</h3>
                        <form class="form-horizontal" th:object="${footBfinfo}" method="post" th:action="@{/hy/footBfinfo/add}" name="form" autocomplete="off" th:if="${null != footBfinfo && canGoOn}">
                        <input type="hidden" name="sj" th:field="*{sj}"/>
                        <input type="hidden" name="qd1" th:field="*{qd1}"/>
                        <input type="hidden" name="qd2" th:field="*{qd2}"/>
                        <input type="hidden" name="bflx" th:field="*{bflx}"/>
                            <h3 class="header smaller lighter blue"><em class="icon-plus"></em>球队常规赛报分</h3>
                            <h4 class="header smaller lighter blue">报分明细</h4>
                            <div class="row-fluid">
                            <!--PAGE CONTENT BEGINS HERE-->
                                <div class="span12">
                                    <table style="width:100%" border="0">
                                        <tbody>
                                            <tr>
                                                <th style="width:60px">赛季:</th>
                                                <td style="width:100px" th:text="${session.sjInfo.sjbm}">123</td>
                                                <th style="width:60px">球队:</th>
                                                <td style="width:100px" th:text="${footBfinfo.qd1Name}">123</td>
                                                <th style="width:60px">进球:<span style="color:red">*</span></th>
                                                <td style="width:100px"><label for="jq1"><input type="text" name="jq1" class="input-mini spinner-input" id="jq1"/></label></td>
                                                <th style="width:60px">进球:<span style="color:red">*</span></th>
                                                <td style="width:100px"><label for="jq2"><input type="text" name="jq2" class="input-mini spinner-input" id="jq2"/></label></td>
                                                <th style="width:60px">球队:<span style="color:red">*</span></th>
                                                <td style="width:200px">
                                                    <input type="text" name="selectqd" id="selectqd" class="input_fix" placeholder="请手动输入对方玩家名称，本搜索支持模糊查询或者双击文本框"/></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                           </div>
                            <div style="clear:both;"></div>
                            <div class="row-fluid hidden-480">
                                <div class="span6">
                                    <h4 class="header smaller lighter blue"><span style="float: left">主队</span></h4>
                                    <table border="0" style="width:100%">
                                        <thead>
                                            <tr>
                                                <th >位置</th>
                                                <th >名字</th>
                                                <th >等级</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr th:each="t:${zhuTeam}">
                                                <td th:replace="common/footer"></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <div class="span6">
                                    <h4 class="header smaller lighter blue"><span style="float: right">客队</span></h4>
                                    <table border="0" style="width:100%" id="kdtable">
                                        <thead>
                                            <tr>
                                                <th >位置</th>
                                                <th >名字</th>
                                                <th >等级</th>
                                            </tr>
                                        </thead>
                                        <tbody id="keTeam">

                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="span12">
                                    <span style="color:red" th:if="${#fields.hasErrors('qd1')}" th:errors="*{qd1}">Name Error</span>
                                </div>
                            </div>
                            <div class="row-fluid">
                                <div class="text-center span12">
                                    <button class="btn btn-primary" type="submit" id="submits"><em class="icon-save"></em>提交</button>
                                    <button class="btn btn-danger" type="reset"><em class="icon-remove"></em>取消</button>
                                    <a class="btn" type="button" th:href="@{/index}"><em class="icon-arrow-left"></em>返回首页</a>
                                </div>
                            </div>
                        </form>
					</div>
				</div>
				<div th:replace="common/skin :: skin"></div>
		</div><!--/#main-content-->
	</div><!--/.fluid-container#main-container-->
	<div th:replace="common/js"></div>
	<script th:src="@{/js/jquery-ui.custom.min.js}"></script>
	<script th:src="@{/js/fuelux/fuelux.spinner.min.js}"></script>
	<script th:src="@{/js/jquery.autosize.min.js}"></script>
    <script th:src="@{/js/colorbox/jquery.colorbox.min.js}"></script>
	<script th:src='@{/js/jquery.autocomplete.min.js}'></script>
    <script type='text/javascript' th:src='@{/js/jquery-migrate-1.4.1.min.js}'></script>
    <script th:src='@{/js/spinbox.min.js}'></script>
    <script type="text/javascript">
   		$(document).ready(function(){
   			var search = [];
   			$.ajax({
				type: "POST",
				dataType: "json",
				url: "/hy/footBfinfo/searchUser",
				success: function(data){
					search = data;
					$("#selectqd").autocomplete(search,{
						minChars: 0,
						width: $("#selectqd").width() + 10,
						//matchContains: "word",
						autoFill: false,
						formatItem: function(row, i, max) {
							return row.nike;
						},
						formatMatch: function(row, i, max) {
							return row.nike;
						},
						formatResult: function(row) {
							return row.nike;
						}
					});
				}
			});
   	    	$("#selectqd").result(function(event, data, formatted) {
				$("#qd2").val(data.id);
				$.ajax({
					type: "POST",
					dataType: "json",
					url: "/hy/footBfinfo/searchPerson",
					data: "userId=" + data.id,
					success: function(info){
						$(info).each(function(index, t){
							var result = "<td>";
							if(t.wzbm === 'GK'){
								result += '<img alt="" src="/images/foot/gk.png"/>';
							}else if(t.wzbm === 'SW'){
								result += '<img alt="" src="/images/foot/sw.png"/>';
							}else if(t.wzbm === 'CB'){
								result += '<img alt="" src="/images/foot/cb.png"/>';
							}else if(t.wzbm === 'LB'){
								result += '<img alt="" src="/images/foot/lb.png"/>';
							}else if(t.wzbm === 'RB'){
								result += '<img alt="" src="/images/foot/rb.png"/>';
							}else if(t.wzbm === 'DMF'){
								result += '<img alt="" src="/images/foot/dmf.png"/>';
							}else if(t.wzbm === 'CMF'){
								result += '<img alt="" src="/images/foot/cmf.png"/>';
							}else if(t.wzbm === 'LMF'){
								result += '<img alt="" src="/images/foot/lmf.png"/>';
							}else if(t.wzbm === 'RMF'){
								result += '<img alt="" src="/images/foot/rmf.png"/>';
							}else if(t.wzbm === 'LWF'){
								result += '<img alt="" src="/images/foot/lwf.png"/>';
							}else if(t.wzbm === 'RWF'){
								result += '<img alt="" src="/images/foot/rwf.png"/>';
							}else if(t.wzbm === 'AMF'){
								result += '<img alt="" src="/images/foot/amf.png"/>';
							}else if(t.wzbm === 'SS'){
								result += '<img alt="" src="/images/foot/ss.png"/>';
							}else if(t.wzbm === 'CF'){
								result += '<img alt="" src="/images/foot/cf.png"/>';
							}
							result += "</td>";
							if(t.qydj === '顶级球星'){
								result += '<td><span style="color: orange; font-weight: bold">' + t.yw + '(' + t.name + ')</span></td>';
								result += '<td><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em></td>';
							}else if(t.qydj === '超级球星'){
								result += '<td><span style="color: purple; font-weight: bold">' + t.yw + '(' + t.name + ')</span></td>';
								result += '<td><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em></td>';
							}else if(t.qydj === '洲际球星'){
								result += '<td><span style="color: blue; font-weight: bold">' + t.yw + '(' + t.name + ')</span></td>';
								result += '<td><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em><em class="icon-star text-warning"></em></td>';
							}else if(t.qydj === '普通球星'){
								result += '<td><span style="color: #9dfe5c; font-weight: bold">' + t.yw + '(' + t.name + ')</span></td>';
								result += '<td><em class="icon-star text-warning"></9dfe5ci><em class="icon-star text-warning"></em></td>';
							}else{
								result += '<td><span style="color: white; font-weight: bold">' + t.yw + '(' + t.name + ')</span></td>';
								result += '<td><em class="icon-star text-warning"></em></td>';
							}
							$("#keTeam").append('<tr>' + result + '</tr>');
						});
					}
				});
			});

			$('#jq1').ace_spinner({value:0,min:0,max:10,step:1, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
				.on('change', function(){});
			$('#jq2').ace_spinner({value:0,min:0,max:10,step:1, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
				.on('change', function(){});
   	  	});    
	</script>
	</body>
</html>
